module.exports = function(fw){

    fw.publish('chatroomModel', 'pub-chatRoom', function(callback){

        var collection = this;
        console.log('publish run...');
        collection.find({}, {sort:[['time',1]]}, function(err, items){
            console.log('push data', items.length);
            callback(items);
        });
    }, {
        beforeInsert: function(serverCollection, structData, userinfo, callback){
            structData.time = (new Date()).valueOf();
            callback(structData);
        }
    });

}
